home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / utils / bibsort / rofvms.awk < prev   
Text File  |  1992-07-31  |  2KB  |  61 lines

  1. # rofvms.awk -*-awk-*-
  2. # Filter to convert nroff -man output to VMS .hlp file format according
  3. # to the rules:
  4. #
  5. #    13 or more consecutive blank lines are reduced to 1
  6. #    3--12 consecutive blank lines are dropped
  7. #    2 consecutive blank lines are reduced to 1
  8. #    All others output verbatim.
  9. #
  10. # The peculiar number 13 handles the case where a paragraph break
  11. # coincides with a page break.
  12. #
  13. # In addition, whenever a line in non-blank in column 1, and then
  14. # previous line was blank, we insert a blank line; this provides
  15. # vertical space before a section heading.
  16. #
  17. # The output of nroff -man on different UNIX systems is regrettably
  18. # quite variable in appearance; this file is likely to need
  19. # modifications on other than Sun OS.
  20. #
  21. # Too bad nroff doesn't have an option to suppress titling!
  22. #
  23. # The NAME section head becomes 1 DVI, and others become
  24. # 2 XXX followed by XXX.
  25. # [05-Aug-89]
  26.  
  27. # Match and delete page headers: xxx(nnn) .... xxx(nnn)
  28. /^[A-Za-z][-_A-Za-z0-9]*\([0-9A-Za-z]+\).*[A-Za-z][-_A-Za-z0-9]*\([0-9A-Za-z]+\)$/  {next;}
  29.  
  30. # Match and delete page footers: Sun Release ...nnn
  31. # These vary from system to system, so extra patterns may be needed here
  32. /^Sun Release.*[0-9]+$/ {next;}    # Sun OS x.x
  33. /^Printed.*[0-9]+$/ {next;}    # BSD 4.3
  34. /^Page [0-9].*$/ {next;}    # Silicon Graphics
  35. /^Version.*Last change:/ {next;}# bibclean.txt on SunOS 4.1.1
  36.  
  37.  
  38. # Match all lines and do blank line processing
  39. {
  40.     if (NF == 0)    # blank line
  41.     nb++;
  42.     else        # non blank line
  43.     {
  44.     if ((nb == 1) || (nb == 2) || (nb >= 13))
  45.         printf("\n");
  46.     else if ((nb > 0) && (substr($0,1,1) != " ") && (nf > 0))
  47.         printf("\n");
  48.     if ($0 == "NAME")    # level 1 header
  49.         $0 = "1 DVI";
  50.     else if (substr($0,1,1) != " ") # level 2 header
  51.     {
  52.         header = $0;
  53.         gsub(/ /,"-",header);
  54.         $0 = "2 " header "\n " $0;
  55.     }
  56.     printf("%s\n",$0);
  57.     nb = 0;
  58.     nf++;
  59.     }
  60. }
  61.